import logging
#通过basicConfig设置日志等级
logging.basicConfig(level=logging.DEBUG)

logging.debug("这是一条debug等级的日志")
logging.info("这是一条info等级的日志")
logging.warning("这是一条warning等级的日志")
logging.error("这是一条error等级的日志")
logging.critical("这是一条critical等级的日志")


class log():
    # def Log1(self):
    #     loger=logging.getLogger()
    #     loger.setLevel(logging.INFO)
    #     ch=logging.StreamHandler()#输出日志到控制台
    #     ch.setLevel(logging.INFO)
    #
    #     fmt=logging.Formatter('%(asctime)s - %(filename)s - %(lineno)d - %(levelname)s - %(message)s')
    #     ch.setFormatter(fmt)
    #     loger.addHandler(ch)
    #     loger.info("这是一个INFO日志")

    def Log2(self):
        log=logging.basicConfig(level=logging.DEBUG,
                                format='%(levelname)s %(filename)s %(asctime)s %(message)s %(lineno)d',
                                filename='movie.log',
                                filemode='a+')
        return log


